package com.asset.web.auth;

import com.asset.pojo.Role;
import com.asset.service.RoleService;
import com.asset.util.PageResult;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/role")
public class RoleController {

    @Resource
    private RoleService roleService;

    @GetMapping("/list")
    public ResponseEntity<PageResult<Role>> selectByPage(
            @RequestParam("page") Integer page,
            @RequestParam("rows") Integer rows,
            @RequestParam(value = "keyWord", required = false) String keyWord,
            @RequestParam(value = "selectAll", required = false) Boolean selectAll
    ) {
        return ResponseEntity.ok(roleService.selectByPage(page, rows, keyWord, selectAll));
    }
}
